<template>
  <div id="farmhouseInspector">
    <div class="tab">
      <ul>
        <li
          v-for="(item, index) in tabArr"
          :class="{ select: nowIndex === index }"
          :key="index"
          @click="tabClick(index)"
        >
          <p>{{ item }}</p>
          <span
            v-if="nowIndex === index"
            style="width: 64px; height: 6px; background: #007aff; border-radius: 3px; display: inline-block"
          >
          </span>
        </li>
      </ul>
    </div>
    <div v-if="nowIndex === 0" class="content" style="height: calc(100vh - 50px)">
      <p style="text-align: center; font-weight: bold; margin-bottom: 10px">农村房屋检查(监督)表</p>

      <div>
        <!-- <van-field required name="radio" label="房屋是否已排查">
          <template #input>
            <van-radio-group v-model="formData.fwpcqk" direction="horizontal">
              <van-radio name="1">已排查</van-radio>
              <van-radio name="2">未排查</van-radio>
              <van-radio name="3">未录入系统</van-radio>
            </van-radio-group>
          </template>
        </van-field> -->
        <van-field readonly v-model="formData.PCR" placeholder="排查人" label="排查人" />
        <van-field readonly v-model="formData.PCSJ" placeholder="排查时间" label="排查时间" />
        <van-field readonly v-model="formData.PROVINCE" placeholder="请输入所属省" label="所属省" />
        <van-field readonly v-model="formData.CITY" placeholder="请输入所属市" label="所属市" />
        <van-field readonly v-model="formData.COUNTY" placeholder="请输入所属区县" label="所属区县" />
        <van-field readonly v-model="formData.TOWN" placeholder="请输入所属乡(镇、街道)" label="所属乡(镇、街道)" />
        <van-field readonly v-model="formData.VILLAGE" placeholder="请输入所属村(社区)" label="所属村(社区)" />
        <van-field
          required
          v-model="formData.CQR"
          placeholder="请输入产权人(使用人)姓名"
          label="产权人(使用人)姓名"
        />
        <van-field required v-model="formData.SFZH" placeholder="请输入身份证" label="身份证" />
        <van-field
          :disabled="!isAdd"
          required
          readonly
          clickable
          name="picker"
          :value="formData.JTYT | inUseName(selectData.FWYTArr)"
          label="具体用途"
          placeholder="请选择"
          @click="isAdd ? (selectData.showPickerFWYT = true) : ''"
        />
        <van-popup v-model="selectData.showPickerFWYT" position="bottom" get-container="#popup">
          <van-picker
            value-key="DICNAME"
            show-toolbar
            :columns="selectData.FWYTArr"
            @confirm="onConfirmFWYT"
            @cancel="selectData.showPickerFWYT = false"
          />
        </van-popup>
        <div>
          <van-field required v-model="formData.JZCS" placeholder="请输入建筑层数" label="建筑层数" />
          <!--<van-field-->
            <!--:disabled="!isAdd"-->
            <!--readonly-->
            <!--clickable-->
            <!--name="picker"-->
            <!--:value="formData.JZCS | inUseName(selectData.columns)"-->
            <!--label="建筑层数"-->
            <!--placeholder="请选择"-->
            <!--@click="isAdd ? (selectData.showPickerIFTSZZ = true) : ''"-->
          <!--/>-->
          <!--<van-popup v-model="selectData.showPickerIFTSZZ" position="bottom" get-container="#popup">-->
            <!--<van-picker-->
              <!--value-key="DICNAME"-->
              <!--show-toolbar-->
              <!--:columns="selectData.columns"-->
              <!--@confirm="onConfirmIFTSZZ"-->
              <!--@cancel="selectData.showPickerIFTSZZ = false"-->
            <!--/>-->
          <!--</van-popup>-->

          <div>
            <van-field  v-model="formData.JZMJ" placeholder="建筑面积" label="建筑面积" />
            <van-field
              required
              readonly
              clickable
              :disabled="!isAdd"
              name="date"
              :value="formData.JCSJ"
              label="建成时间(竣工日期)："
              placeholder="请选择建成时间(竣工日期)"
              @click="isAdd?selectData.showPickerq = true:''"
            />
            <van-popup v-model="selectData.showPickerq" position="bottom">
              <van-datetime-picker  v-model="selectData.currentDate" type="date" title="选择年月日" @cancel="selectData.showPickerq = false" @confirm="onConfirmRQ" />
            </van-popup>
          </div>
        </div>
        <van-field
          :disabled="!isAdd"
          required
          readonly
          clickable
          name="picker"
          :value="formData.JGLX | inUseName(selectData.columnsJGLX)"
          label="结构类型"
          placeholder="请选择"
          @click="isAdd ? (selectData.showPickerJGLX = true) : ''"
        />
        <van-popup v-model="selectData.showPickerJGLX" position="bottom" get-container="#popup">
          <van-picker
            value-key="DICNAME"
            show-toolbar
            :columns="selectData.columnsJGLX"
            @confirm="onConfirmJGLX"
            @cancel="selectData.showPickerJGLX = false"
          />
        </van-popup>
      </div>
    </div>
    <div v-if="nowIndex === 1" class="content">
      <p style="text-align: center; font-weight: bold; margin-bottom: 10px">农村房屋检查(监督)表</p>
      <div class="list">
        <ul>
          <li
            v-for="(item, index) in contentData"
            :key="index + 'contentData'"
            :style="{
              borderBottom: index === contentData.length - 1 ? 'none' : '1px solid #D2D2D2',
            }"
          >
            <span style="color: red">*</span>
            <span style="color: #007aff">{{ item.name }}</span>
            <div size="mini">
              <div
                class="btn-style"
                v-for="(item1, index1) in item.children"
                :key="index1 + 'children'"
                :style="{
                  borderBottom: item.children.length - 1 === index1 ? 'none' : '',
                }"
                :label="item1.name"
              >
                <span v-if="item1.type == 'select'" style="padding-top: 10px">
                  <van-field
                    style="padding: 10px 0"
                    readonly
                    :required="item1.required"
                    clickable
                    name="picker"
                    :value="formData[item1.key] | inUseName(item1.ARR)"
                    :label="item1.name"
                    placeholder="请选择"
                    @click="item1.name !== '安全隐患初判' ? (isAdd ? (item1.active = true) : '') : ''"
                  />
                  <van-popup v-model="item1.active" position="bottom" get-container="#popup">
                    <van-picker
                      :required="item1.required"
                      value-key="DICNAME"
                      show-toolbar
                      :columns="item1.ARR"
                      @confirm="onConfirmContent"
                      @cancel="item1.active = false"
                    />
                  </van-popup>
                </span>
                <span v-else-if="item1.type == 'text'" style="font-size: 14px"> </span>

                <span v-else-if="item1.type == 'Checkbox'">
                  <p v-if="item.name == '检查(督察)结论'" style="font-size: 14px">
                    与房屋建筑和市政设施调查系统符合情况
                  </p>
                  <!--<p v-if="item.name=='抽查结果'" style="font-size: 14px">与房屋建筑和市政设施调查系统符合情况：</p>-->
                  <van-radio-group v-model="formData[item1.key]" direction="horizontal" :disabled="!isAdd">
                    <van-radio
                      style="margin-bottom: 5px; font-size: 14px"
                      v-for="(item2, index2) in item1.children"
                      :key="index2 + 'childrens'"
                      :name="item2.value"
                      >{{ item2.name }}
                    </van-radio>
                  </van-radio-group>
                  <!--<span v-if="item.name == '初步判定' && formData.checkFirstResult == '1'" style="font-size: 14px"-->
                    <!--&gt;当房屋无以上情况且处于正常使用情况下或已鉴定为 A、B级。</span-->
                  <!--&gt;-->
                  <!--<span v-if="item.name == '初步判定' && formData.checkFirstResult == '2'" style="font-size: 14px">-->
                    <!--当存在以上一条或多条状况时，初判存在危险，房屋应进行鉴定，并根据鉴定结论分类处置-->
                  <!--</span>-->
                  <!--<span v-if="item.name == '初步判定' && formData.checkFirstResult == '3'" style="font-size: 14px">-->
                    <!--明显存在倒塌危险-->
                  <!--</span>-->
                <!--</span>-->
                <!--<span v-else-if="item1.type == 'input'">-->
                  <!--<van-field-->
                    <!--:required="item1.required"-->
                    <!--:readonly="!isAdd"-->
                    <!--v-model="formDataPC[item1.key]"-->
                    <!--:placeholder="item1.placeholder"-->
                    <!--:label="item1.name"-->
                  <!--/>-->
                </span>
                <span v-else>
                  <van-checkbox-group v-model="formData[item.key]">
                    <van-checkbox
                      @click="mutualClick(item1, item)"
                      style="margin-bottom: 10px"
                      shape="square"
                      :name="item1.value"
                    >
                      {{ item1.name }}
                    </van-checkbox>
                  </van-checkbox-group>
                  <span style="float: right; padding-top: 10px"> </span>
                  <span v-for="(item3, index3) in item1.fileData" :key="index3 + 'fileData3'">
                    <van-uploader
                      :disabled="!isAdd"
                      @click-upload="getList(item3)"
                      :after-read="afterRead"
                      :before-delete="delectFile"
                      v-model="item3.fileList"
                      accept=".jpg,.gif,.png,.jpeg"
                      multiple
                    />
                  </span>
                </span>
              </div>
              <div v-for="(item2, index2) in item.fileData" :key="index2 + 'fileData'">
                <p style="font-size: 14px">
                  {{ item2.name }}
                </p>
                <van-uploader
                  :disabled="!isAdd"
                  @click-upload="getList(item2)"
                  :after-read="afterRead"
                  :before-delete="delectFile"
                  v-model="item2.fileList"
                  accept=".jpg,.gif,.png,.jpeg"
                  multiple
                />
              </div>
            </div>
          </li>
        </ul>
      </div>
    </div>
     <div v-if="nowIndex === 2">
      <!-- historicalRecord -->
      <synergy />
    </div>
        <div v-if="nowIndex === 3">
      <!-- historicalRecord -->
      <historicalRecord />
    </div>
    <div class="footer" v-if="nowIndex === 1 && ISShow">
      <!--<van-button :disabled="saveStatus" size="small" type="info" @click="deleteData">删除</van-button>-->

      <van-button size="small" style="width: 40%;" type="info" @click="saveUpdates">保存</van-button>
      <van-button size="small" style="width: 40%;" type="info" @click="submitData">提交</van-button>
    </div>
  </div>
</template>

<script>
import {
  FileServerProxy,
  houseCheckFwCheckDetails,
  FwsaveOrUpdate,
  FwsaveOrDelete,
  uploadFile,
  deleteFile,
  selectListFile,
  getPoliceData,
  getTeshuInfo,
  getZongJiaoInfo,
  saveFwCheck,
  getFwCheck,
  FwsaveOrDeleteFwCheck,
} from '../../../utils/api'
import historicalRecord from './historicalRecord'
import synergy from './synergy'
import { Dialog } from 'vant'
export default {
  name: 'farmhouseInspector',
  filters: {
    inUseName: function (msg, data) {
      let name = ''
      data.forEach((item) => {
        if (item.DICID == msg) {
          name = item.DICNAME
        }
      })
      return name
    },
  },
  components: {
    historicalRecord,
    synergy
  },
  data() {
    return {
      ishz: false,
      isyezz: false,
      saveStatus: false,
      ISShow: true,
      UploadFileId: [],
      cityName: '',
      JZJG: [
        {
          name: '砖砌墙',
          DICID: '0',
          children: [
            {
              name: '无异常',
              key: 'liveBrickIsError',
              value: '1',
            },
            {
              name: '墙体普遍开裂，剥蚀严重',
              key: 'liveBrickIsAge',
              value: '1',
            },
            {
              name: '纵横墙体交接处竖向开裂',
              key: 'liveBrickIsCrack',
              value: '1',
            },
            {
              name: '墙体有歪斜',
              key: 'liveBrickIsAngle',
              value: '1',
            },
            {
              name: '局部倒塌或有倒塌危险',
              key: 'liveBrickIsSubside',
              value: '1',
            },
            {
              name: '使用小型混凝土空心砌块',
              key: 'liveBrickIsAirBrick',
              value: '1',
            },
            {
              name: '受潮渗漏',
              key: 'liveBrickIsLeak',
              value: '1',
            },
          ],
        },
        {
          name: '石砌墙',
          DICID: '1',
          children: [
            {
              name: '无异常',
              key: 'liveStoneIsError',
              value: '1',
            },
            {
              name: '墙体普遍开裂或开裂严重，明显空鼓，部分石料松动',
              key: 'liveStoneIsCrack',
              value: '1',
            },
            {
              name: '纵横墙体交接处竖向开裂，墙体有歪斜',
              key: 'liveStoneIsAngle',
              value: '1',
            },
            {
              name: '局部倒塌或有倒塌危险',
              key: 'liveStoneIsSubside',
              value: '1',
            },
            {
              name: '墙体采用乱毛石、鹅卵石砌筑，或砌筑砂浆为泥浆或无浆干砌的',
              key: 'liveStoneIsBad',
              value: '1',
            },
          ],
        },
        {
          name: '生土墙体',
          DICID: '2',
          children: [
            {
              name: '无异常',
              key: 'liveSoilIsError',
              value: '1',
            },
            {
              name: '墙体开裂严重',
              key: 'liveSoilIsCrack',
              value: '1',
            },
            {
              name: '墙面明显剥蚀、空鼓严重',
              key: 'liveSoilIsAge',
              value: '1',
            },
            {
              name: '纵横墙体交接处竖向开裂',
              key: 'liveSoilIsVerticalCrack',
              value: '1',
            },
            {
              name: '墙体有歪斜',
              key: 'liveSoilIsAngle',
              value: '1',
            },
            {
              name: '局部倒塌或有倒塌危险',
              key: 'liveSoilIsSubside',
              value: '1',
            },
            {
              name: '处于长期受潮状态或周边排水不畅的生土墙体',
              key: 'liveSoilIsLeak',
              value: '1',
            },
          ],
        },
        {
          name: '承重木构架',
          DICID: '3',
          children: [
            {
              name: '无异常',
              key: 'liveWoodIsError',
              value: '1',
            },
            {
              name: '明显腐朽或虫蛀',
              key: 'liveWoodIsAge',
              value: '1',
            },
            {
              name: '梁、檩跨中明显变形或出现横向裂缝',
              key: 'liveWoodIsCrack',
              value: '1',
            },
            {
              name: '梁、檩端部出现劈裂',
              key: 'liveWoodIsRip',
              value: '1',
            },
            {
              name: '柱身明显歪斜',
              key: 'liveWoodIsAngle',
              value: '1',
            },
            {
              name: '木柱与柱基础之间错位',
              key: 'liveWoodIsSubside',
              value: '1',
            },
            {
              name: '构件纵向有明显干缩裂缝',
              key: 'liveWoodIsAirDried',
              value: '1',
            },
            {
              name: '卯榫节点有破损或有拔榫迹象',
              key: 'liveWoodIsPool',
              value: '1',
            },
            {
              name: '承重柱存在接柱或转换情况且未采取可靠连接措施',
              key: 'liveWoodIsLink',
              value: '1',
            },
          ],
        },
        {
          name: '梁柱混凝土构件',
          DICID: '4',
          children: [
            {
              name: '无异常',
              key: 'liveBetonIsError',
              value: '1',
            },
            {
              name: '保护层剥落严重',
              key: 'liveBoardIsAge',
              value: '1',
            },
            {
              name: '钢筋露筋、锈蚀，出现明显锈胀裂缝',
              key: 'liveBoardIsCrack',
              value: '1',
            },
            {
              name: '梁柱出现明显受力裂缝和变形',
              key: 'liveBoardIsAngle',
              value: '1',
            },
          ],
        },
        {
          name: '楼板混凝土构件',
          DICID: '5',
          children: [
            {
              name: '无异常',
              key: 'liveBetonIsError',
              value: '1',
            },
            {
              name: '保护层剥落严重',
              key: 'liveBoardIsAge',
              value: '1',
            },
            {
              name: '钢筋露筋、锈蚀，出现明显锈胀裂缝',
              key: 'liveBetonIsCrack',
              value: '1',
            },
            {
              name: '楼板出现明显受力裂缝和变形。',
              key: 'liveBetonIsAngle',
              value: '1',
            },
          ],
        },
        // {
        // name: "其他情况",
        // DICID: "6",
        // children: [
        //   {
        //     name: "其他存在危险性的情况",
        //     type: "input",
        //     key: "liveOtherQuestion",
        //     value: "1",
        //     required: true,
        //   },
        // ],
        // },
      ],
      showData: false,
      isAdd: true,
      formDataPC: {
        fwid: '',
        buildEnums: [],
        baseEnums: [],
        liveBrickEnums: [],
        liveWoodEnums: [],
        liveBetonEnums: [],
        houseEnums: [],
        useEnums: [],
        checkFirstResult: '',
        jcIsFirstRestut: '',
        jcHouseCheckCompany: '',
        jcIsJd: '',
        jcIsJdbg: '',
        jcIsZpxt: '',
        jcWfzz: '',
        jcHouseUse: '',
        jcOther: '',
        checkVertifyResult: '',
      },
      contentData: [
        {
          name: '周边情况',
          key: 'ZBQK',
          children: [
            {
              name: '无异常',
              key: 'buildIsError',
              value: '1',
            },
            {
              name: "房屋周边地面长期积水",
              key: "buildIsWater",
              value: "",
            },
            // {
            //   name: '房屋上装有大型广告牌',
            //   key: 'buildIsBillboard',
            //   value: '2',
            // },
            {
              name: '房屋周边有工程建设和深基坑 施工情况',
              key: 'buildIsRoadwork',
              value: '3',
            },
            {
              name: '房屋周边有影响安全的危险因素(例如山体滑坡是否稳定、有没有危岩、落石等)',
              key: 'buildIsDanger',
              value: '4',
            },
            // {
            //   name: '是否河道建房',
            //   key: 'buildIsDanger',
            //   value: '5',
            // },
            // {
            //   name: '是否有未经设计擅自加层的情况',
            //   key: 'buildIsAddfloor',
            //   value: ''
            // },
            {
              name: '有破墙开门、开窗或开店等影响结构安全的行为，或其他改变使用功能有较大变动情况',
              key: 'buildIsStructure',
              value: '6',
            },
          ],
        },
        {
          name: '地基基础',
          key: 'DJJC',
          children: [
            {
              name: '无异常',
              key: 'baseIsError',
              value: '1',
            },
            {
              name: '房屋出现明显不均匀沉降（斜向）裂缝',
              key: 'baseIsCrack',
              value: '2',
            },
            {
              name: '外露基础明显腐蚀、酥碱、松散 和剥落',
              key: 'baseIsAge',
              value: '3',
            },
            {
              name: '裂缝持续发展尚未稳定',
              key: 'baseIsAge',
              value: '4',
            },
            {
              name: '出现明显倾斜',
              key: 'baseIsSubside',
              value: '5',
            },
             {
              name: '基础局部或整体塌陷的',
              key: 'baseIsAge',
              value: '6',
            }
          ],
        },
        {
          name: '墙体',
          key: 'QT',
          children: [
            {
              name: '无异常',
              key: 'buildIsError',
              value: '1',
            },
             {
              name: '墙体开裂严重',
              key: 'buildIsError',
              value: '2',
            },
            {
              name: '墙体有歪斜',
              key: 'buildIsWater',
              value: '3',
            },
            {
              name: '局部倒塌或有倒塌危险',
              key: 'buildIsBillboard',
              value: '4',
            }
          ],
        },
        {
          name: '柱、梁、板',
          key: 'ZLB',
          children: [
            {
              name: '无异常',
              key: 'buildIsError',
              value: '1',
            },
            {
              name: '钢筋露筋、锈蚀,出现明显锈胀裂缝',
              key: 'buildIsWater',
              value: '3',
            },
            {
              name: '梁柱有明显受力裂缝和变形',
              key: 'buildIsBillboard',
              value: '4',
            }
          ],
        },
        {
          name: '楼层面',
          key: 'LWM',
          children: [
            {
              name: '无异常',
              key: 'buildIsError',
              value: '1',
            },
            {
              name: '明显变形',
              key: 'buildIsWater',
              value: '2',
            },
            {
              name: '明显裂缝',
              key: 'buildIsBillboard',
              value: '3',
            },
            {
              name: '较严重渗漏',
              key: 'buildIsRoadwork',
              value: '4',
            },
            {
              name: '老化破损',
              key: 'buildIsRoadwork',
              value: '5',
            },
          ],
        },
        {
          name: '木结构',
          key: 'MJG',
          children: [
            {
              name: '无异常',
              key: 'buildIsError',
              value: '1',
            },
            {
              name: '明显腐朽或虫蛀',
              key: 'buildIsWater',
              value: '2',
            },
            {
              name: '梁、橝跨中明显变形或出现横向裂纹',
              key: 'buildIsBillboard',
              value: '3',
            },
             {
              name: '梁、橝端部出现劈裂',
              key: 'buildIsBillboard',
              value: '4',
            },
             {
              name: '柱身有明显歪斜',
              key: 'buildIsBillboard',
              value: '5',
            },
             {
              name: '木柱于柱基础之间错位',
              key: 'buildIsBillboard',
              value: '6',
            },
             {
              name: '构件纵向有明显干缩裂缝',
              key: 'buildIsBillboard',
              value: '7',
            },
             {
              name: '卯榫节点有破损或有拔榫迹象',
              key: 'buildIsBillboard',
              value: '8',
            },
             {
              name: '承重柱存在接柱或转换情况且未采取可靠连接措施',
              key: 'buildIsBillboard',
              value: '9',
            },
          ],
        },
        {
          name: '初步判定',
          children: [
            {
              type: 'Checkbox',
              key: 'CBPD',
              children: [
                {
                  name: '基本安全(甲类、乙类)',
                  value: '1',
                  key: 'house_is_error',
                },
                {
                  name: '存在安全隐患(丙类、需要安全鉴定)',
                  value: '2',
                  key: 'house_is_transform',
                },
                // {
                //   name: '危险房屋',
                //   value: '3',
                //   key: 'house_is_crack',
                // },
              ],
              disabled: false,
            },
          ],
        },
        // {
        //   name: '初步判定是否准确',
        //   children: [
        //     {
        //       type: 'Checkbox',
        //       key: 'jcIsFirstRestut',
        //       children: [
        //         {
        //           name: '准确',
        //           value: '1',
        //           key: 'house_is_error',
        //         },
        //         {
        //           name: '不准确',
        //           value: '2',
        //           key: 'house_is_transform',
        //         },
        //       ],
        //       disabled: false,
        //     },
        //   ],
        // },
        // {
        //   name: '房屋安全鉴定机构是否符合资质要求',
        //   children: [
        //     {
        //       type: 'Checkbox',
        //       key: 'jcHouseCheckCompany',
        //       children: [
        //         {
        //           name: '符合',
        //           value: '1',
        //           key: 'house_is_error',
        //         },
        //         {
        //           name: '不符合',
        //           value: '2',
        //           key: 'house_is_transform',
        //         },
        //       ],
        //       disabled: false,
        //     },
        //   ],
        // },
        // {
        //   name: '房屋安全鉴定情况',
        //   children: [
        //     {
        //       type: 'Checkbox',
        //       key: 'jcIsJd',
        //       children: [
        //         {
        //           name: '已鉴定',
        //           value: '1',
        //           key: 'house_is_error',
        //         },
        //         {
        //           name: '未鉴定',
        //           value: '2',
        //           key: 'house_is_transform',
        //         },
        //       ],
        //       disabled: false,
        //     },
        //   ],
        // },
        // {
        //   name: '鉴定报告内容',
        //   children: [
        //     {
        //       type: 'Checkbox',
        //       key: 'jcIsJdbg',
        //       children: [
        //         {
        //           name: '完整',
        //           value: '1',
        //           key: 'house_is_error',
        //         },
        //         {
        //           name: '不完整',
        //           value: '2',
        //           key: 'house_is_transform',
        //         },
        //       ],
        //       disabled: false,
        //     },
        //   ],
        // },
        // {
        //   name: '房屋照片是否与现场一致',
        //   children: [
        //     {
        //       type: 'Checkbox',
        //       key: 'jcIsZpxt',
        //       children: [
        //         {
        //           name: '一致',
        //           value: '1',
        //           key: 'house_is_error',
        //         },
        //         {
        //           name: '不一致',
        //           value: '2',
        //           key: 'house_is_transform',
        //         },
        //       ],
        //       disabled: false,
        //     },
        //   ],
        // },
        // {
        //   name: '房屋整治情况',
        //   children: [
        //     {
        //       type: 'Checkbox',
        //       key: 'jcWfzz',
        //       children: [
        //         {
        //           name: '已落实工程整治措施',
        //           value: '1',
        //           key: 'house_is_error',
        //         },
        //         {
        //           name: '已落实管控措施',
        //           value: '2',
        //           key: 'house_is_transform',
        //         },
        //         {
        //           name: '未落实工程整治措施',
        //           value: '3',
        //           key: 'house_is_transform',
        //         },
        //         {
        //           name: '未落实工程整治措施',
        //           value: '4',
        //           key: 'house_is_transform',
        //         },
        //         {
        //           name: '落实整治措施与应落实措施不一致',
        //           value: '5',
        //           key: 'house_is_transform',
        //         },
        //       ],
        //       disabled: false,
        //     },
        //   ],
        // },
        // {
        //   name: '危房使用情况',
        //   children: [
        //     {
        //       type: 'Checkbox',
        //       key: 'jcHouseUse',
        //       children: [
        //         {
        //           name: '存在住人现象',
        //           value: '1',
        //           key: 'house_is_error',
        //         },
        //         {
        //           name: '存在使用情况',
        //           value: '2',
        //           key: 'house_is_transform',
        //         },
        //       ],
        //       disabled: false,
        //     },
        //   ],
        // },
        // {
        //   name: '其他问题',
        //   children: [
        //     {
        //       type: 'input',
        //       key: 'jcOther',
        //       placeholder: '请输入其他问题',
        //     },
        //   ],
        // },
        // {
        //   name: '检查(督察)结论',
        //   children: [
        //     {
        //       type: 'Checkbox',
        //       key: 'checkVertifyResult',
        //       children: [
        //         {
        //           name: '相符',
        //           value: '0',
        //           key: 'house_is_error',
        //         },
        //         {
        //           name: '基本相符',
        //           value: '1',
        //           key: 'house_is_transform',
        //         },
        //         {
        //           name: '不相符',
        //           value: '2',
        //           key: 'house_is_crack',
        //         },
        //       ],
        //       disabled: false,
        //     },
        //   ],
        // },
      ],
      nowIndex: 0,
      tabArr: ['基本情况', '现场状况', '部门协同','历史记录'],
      selectData: {
        showPickerq: false,
        currentDate: new Date(),
        showPicker: false,
        columns: [
          {
            DICNAME: '是',
            DICID: '1',
          },
          {
            DICNAME: '否',
            DICID: '2',
          },
        ],
        showPickerFWLX: false,
        FWLXArr: [
          {
            DICNAME: '自建房',
            DICID: '1',
          },
          {
            DICNAME: '非自建房',
            DICID: '2',
          },
        ],
        showPickerFWYT: false,
        FWYTArr: [
          {
            DICNAME: '经营性自建房',
            DICID: '606',
          },
          {
            DICNAME: '其他自建房',
            DICID: '607',
          },
        ],
        showPickerIFTSZZ: false,
        showPickerJGLX: false,
        columnsJGLX: [
          {
            DICNAME: '砌体结构',
            DICID: '1',
          },
          {
            DICNAME: '底部框架-上部砌体结构',
            DICID: '2',
          },
          {
            DICNAME: '钢筋混凝土结构',
            DICID: '3',
          },
          {
            DICNAME: '钢结构',
            DICID: '4',
          },
          {
            DICNAME: '木(竹)结构',
            DICID: '5',
          },

          {
            DICNAME: '窑洞',
            DICID: '6',
          },
          {
            DICNAME: '混杂结构',
            DICID: '7',
          },
          {
            DICNAME: '土木/石木结构',
            DICID: '8',
          },
          {
            DICNAME: '其他',
            DICID: '99',
          },
        ],
        showPickerGKJ: false,
        showPickerJTJG: false,
        columnsJTJG: [
          {
            DICNAME: '预制板',
            DICID: '1',
          },
          {
            DICNAME: '现浇板',
            DICID: '2',
          },
          {
            DICNAME: '木或轻钢楼层盖',
            DICID: '3',
          },
          {
            DICNAME: '石板或石条',
            DICID: '4',
          },
        ],
      },
      showjtfwyt: false,
      formData: {
        PCR:'',
        PCSJ:'',
        PROVINCE:'',
        CITY:'',
        COUNTY:'',
        TOWN:'',
        VILLAGE:'',
        CQR:'',
        SFZH:'',
        JTYT:'',
        JZCS:'',
        JZMJ:'',
        JCSJ:'',
        JGLX:'',
        ZBQK:[],
        DJJC:[],
        QT:[],
        ZLB:[],
        LWM:[],
        MJG:[],
        CBPD:'',
        PKID:''
      },
      isSave: true,
      isNewSave:true,
    }
  },
  methods: {
    mutualClick(item, item1) {
      console.log(this.formDataPC[item1.key])
      if (item1.key !== 'useEnums') {
        if (item.name == '无异常') {
          this.formDataPC[item1.key] = ['1']
        } else {
          this.formDataPC[item1.key].forEach((item, index) => {
            if (item == '1') {
              this.formDataPC[item1.key].splice(index, 1)
            }
          })
          console.log(this.formDataPC[item1.key])
        }
        console.log(this.formDataPC)
        let arr = []
        for (let i in this.formDataPC) {
          console.log(this.formDataPC[i])
          if (typeof this.formDataPC[i] == 'object' && this.formDataPC[i][0] == '1') {
            arr.push(this.formDataPC[i][0])
          }
        }
        console.log(arr)
        if (arr.length !== 6) {
          this.contentData.forEach((item, index) => {
            if (item.name == '初步判定') {
              item.children.forEach((item1, index1) => {
                if (item1.children.length == 3) {
                  item1.children.splice(0, 1)
                }
              })
            }
          })
        } else {
          this.contentData.forEach((item, index) => {
            if (item.name == '初步判定') {
              item.children.forEach((item1, index1) => {
                if (item1.children.length == 2) {
                  item1.children.unshift({
                    name: '房屋基本安全',
                    value: '1',
                    key: 'house_is_error',
                  })
                }
              })
            }
          })
        }
      }
    },
    NumberCheck: async function () {
      let params = {
        accessCode: 'a02f84a3615d11ec87416805cab640a0',
        cityCode: window.sessionStorage.getItem('citycodeCun'),
        appKey: '6738b790-69e8-11ec-a673-6805cab640a0',
        params: { entname: this.formData.cqdwmc },
      }
      const res1 = await getPoliceData(params)
      if (res1.data.code == '200' && res1.data.data.datas && JSON.parse(res1.data.data.datas).length > 0) {
        this.isyezz = true
        this.formData.cqdwxydm = JSON.parse(res1.data.data.datas)[0].ELC_LICENCE_STRUCT.DATA.UNISCID
        this.formData.cqdwfr = JSON.parse(res1.data.data.datas)[0].ELC_LICENCE_STRUCT.DATA.NAME
      } else {
        this.isyezz = false
      }
      if (this.isyezz) {
        this.$toast.success('核验成功!')
      } else {
        Dialog.alert({
          title: '提示',
          message: '经与工商局大数据信息核对，您录入的企业信息不存在，请核实。',
        }).then(() => {
          // on close
        })
        // this.$toast.fail("经与工商局大数据信息核对，您录入的企业信息不存在，请核实。");
      }
    },
    onclickplice: async function () {
      var p = {
        appKey: '6738b790-69e8-11ec-a673-6805cab640a0',
        accessCode: '4f54f932615d11ec87416805cab640a0',
        cityCode: window.sessionStorage.getItem('citycodeCun'),
        params: { czrkgmsfhm: this.formData.cqrzjhm },
      }
      var resData = await getPoliceData(p)
      if (resData.data.data && resData.data.data.datas && resData.data.data.datas.length > 0) {
        resData.data.data.datas.forEach((item) => {
          if (
            item.ELC_LICENCE_STRUCT.DATA.CZRKGMSFHM == this.formData.cqrzjhm &&
            item.ELC_LICENCE_STRUCT.DATA.CZRKHZXM == this.formData.cqrxm &&
            item.ELC_LICENCE_STRUCT.DATA.CZRKYHZGX == '户主'
          ) {
            this.ishz = true
          }
        })
      } else {
        this.ishz = false
      }
      this.$nextTick(() => {
        if (this.ishz) {
          this.$toast.success('核验成功!')
        } else {
          Dialog.alert({
            title: '提示',
            message: '经与公安厅户籍大数据信息核对，您录入的人员信息不存在，请核实。',
          }).then(() => {})
          // this.$toast.fail("");
        }
      })
    },
    editData() {
      if (this.rowData) {
        this.isAdd = true
      } else {
      }
    },
    radioChangef(data, event) {
      if (data.name === '无异常') {
      } else {
        let arr = []
        for (let i in this.formDataPC) {
          if (
            i != 'buildIsError' &&
            i != 'baseIsError' &&
            i != 'houseIsError' &&
            i != 'liveIsError' &&
            i != 'liveSoilIsError' &&
            i != 'liveStoneIsError' &&
            i != 'liveWoodIsError' &&
            i != 'liveBetonIsError' &&
            i != 'liveBrickIsError' &&
            i != 'checkFirstResult' &&
            i != 'liveStructerType' &&
            i != 'checkVertifyResult' &&
            i != 'isCheck'
          ) {
            if (this.formDataPC[i] == '0') {
              arr.push(this.formDataPC[i])
            }
          }
        }
        if (arr.indexOf('0') !== -1) {
          this.contentData.forEach((item, index) => {
            if (item.name == '初步判定') {
              item.children.forEach((item1, index1) => {
                if (item1.children.length == 3) {
                  item1.children.splice(0, 1)
                }
              })
            }
          })
        } else {
          this.contentData.forEach((item, index) => {
            if (item.name == '初步判定') {
              item.children.forEach((item1, index1) => {
                if (item1.children.length == 2) {
                  item1.children.unshift({
                    name: '房屋基本安全',
                    value: '1',
                    key: 'house_is_error',
                  })
                }
              })
            }
          })
        }
      }
    },
    radioClick(data, event) {
      if (data.name === '无异常') {
        if (this.formDataPC[data.key] == '0') {
          this.contentData.forEach((item, index) => {
            if (item.name == event.name) {
              item.children.forEach((item1, index) => {
                if (item1.key !== data.key) {
                  if (item1.key !== 'liveStructerType') {
                    this.formDataPC[item1.key] = '1'
                  }
                }
              })
            }
          })
        } else {
          this.contentData.forEach((item, index) => {
            if (item.name == event.name) {
              item.children.forEach((item1, index) => {
                if (item1.key !== data.key) {
                  if (item1.key !== 'liveStructerType') {
                    this.formDataPC[item1.key] = '2'
                  }
                }
              })
            }
          })
        }
      } else {
      }
    },
    getData: async function () {

      let params = {
        accessCode: '688bd3883572440a859dfd8ba9194e7b',
        cityCode: window.localStorage.getItem('citycode') ? window.localStorage.getItem('citycode') : '441300000000',
        params: {
          dataguid: "760e6043-1b3a-4c10-b407-729c69c74dc0",
          searchObject: JSON.stringify([{ field: 'to_row_guid', value: this.rowData.ROW_GUID, operator: '=' }]),
          token: window.localStorage.getItem('token'),
        },
      }
      const res = await FileServerProxy(params)
      let data1 = JSON.parse(res.data.data).Data[0]
      console.log(data1)
      if (data1){
        this.isNewSave = false
        for (let i in this.formData){
          if (data1[i]){
              this.formData[i] = data1[i]
          }
        }
        console.log(this.formData)
      }else{
        let paerssend2 = {
          procName: 'up_management',
          dtParams: JSON.stringify([
            {
              I_USERID: this.rowData.ROW_GUID,
              I_TYPE: 13,
            },
          ]),
          token: window.localStorage.getItem('token'),
        }
        let paramsendMEssage2 = {
          accessCode: '69db6bece3a7480592e2ec753d1e335e',
          cityCode: window.localStorage.getItem('citycode')
            ? window.localStorage.getItem('citycode')
            : '441300000000',
          params: paerssend2,
        }
        const reqwmsg2 = await FileServerProxy(paramsendMEssage2)
        console.log( JSON.parse(reqwmsg2.data.data))
        let data = JSON.parse(reqwmsg2.data.data).Data[0]
        for (let i in this.formData){
          if (data[i]){
            if(i!=='COUNTY' && i!=='TOWN' && i!=='VILLAGE' && i!=='CITY'){
              this.formData[i] = data[i]
            }else{
              this.formData.CITY = data.SNC
              this.formData.TOWN = data.XZMC
              this.formData.VILLAGE = data.CMC
              this.formData.COUNTY = data.QXMC
            }
          }
        }
        this.isNewSave = true
      }
      console.log(JSON.parse(res.data.data))

    },
    updateData: async function () {
      this.isSave = true
      if (this.formData.housetype == '1') {
        let p = {
          appKey: '6738b790-69e8-11ec-a673-6805cab640a0',
          accessCode: '4f54f932615d11ec87416805cab640a0',
          cityCode: window.sessionStorage.getItem('citycodeCun'),
          params: { czrkgmsfhm: this.formData.cqrzjhm },
        }
        let resData = await getPoliceData(p)
        if (resData.data.data && resData.data.data.datas && resData.data.data.datas.length > 0) {
          resData.data.data.datas.forEach((item) => {
            if (
              item.ELC_LICENCE_STRUCT.DATA.CZRKGMSFHM == this.formData.cqrzjhm &&
              item.ELC_LICENCE_STRUCT.DATA.CZRKHZXM == this.formData.cqrxm &&
              item.ELC_LICENCE_STRUCT.DATA.CZRKYHZGX == '户主'
            ) {
              // if (item.ELC_LICENCE_STRUCT.DATA.CZRKYHZGX == "户主") {
              this.ishz = true
              // } else {
              //   this.ishz = false;
              // }
            }
          })
          this.$nextTick(() => {
            if (this.ishz) {
              this.saveUpdateData()
            } else {
              Dialog.alert({
                title: '提示',
                message: '经与公安厅户籍大数据信息核对，您录入的人员信息不存在，请核实。',
              }).then(() => {
                // on close
              })
            }
          })
        } else {
          Dialog.alert({
            title: '提示',
            message: '经与公安厅户籍大数据信息核对，您录入的人员信息不存在，请核实。',
          }).then(() => {
            // on close
          })
        }
      } else {
        let params = {
          accessCode: 'a02f84a3615d11ec87416805cab640a0',
          cityCode: window.sessionStorage.getItem('citycodeCun'),
          appKey: '6738b790-69e8-11ec-a673-6805cab640a0',
          params: { entname: this.formData.cqdwmc },
        }
        const res1 = await getPoliceData(params)
        if (res1.data.code == '200' && res1.data.data.datas && JSON.parse(res1.data.data.datas).length > 0) {
          this.isyezz = true
          if (JSON.parse(res1.data.data.datas)[0]) {
            if (JSON.parse(res1.data.data.datas)[0].ELC_LICENCE_STRUCT.DATA.UNISCID == this.formData.cqdwxydm) {
              this.saveUpdateData()
            } else {
              Dialog.alert({
                title: '提示',
                message: '经与工商局大数据信息核对，您录入的企业信息不存在，请核实。',
              }).then(() => {})
            }
            // UNISCID
          }
          // console.log(JSON.parse(res1.data.data.datas))
          //
        } else {
          this.isyezz = false
          Dialog.alert({
            title: '提示',
            message: '经与工商局大数据信息核对，您录入的企业信息不存在，请核实。',
          }).then(() => {
            // on close
          })
        }
      }
      this.saveUpdateData()
    },
    // getZongJiaoInfo
    saveUpdateData: async function () {
      console.log(this.formData.jtfwyt)
      if (this.formData.jtfwyt) {
        this.formData.jtfwyt.forEach(async (item) => {
          if (item == '2') {
            let params = {
              appKey: '6738b790-69e8-11ec-a673-6805cab640a0',
              accessCode: '',
              creditCode: this.formData.jtfwytxydm,
            }
            const res1 = await getTeshuInfo(params)
            if (res1.data.data.length > 0) {
              this.saveUpdates()
            } else {
              Dialog.alert({
                title: '提示',
                message: '经与特殊行业大数据信息核对，您录入的信息不存在，请核实。',
              }).then(() => {})
            }
          } else if (item == '13') {
            let params = {
              appKey: '6738b790-69e8-11ec-a673-6805cab640a0',
              accessCode: '',
              creditCode: this.formData.jtfwytxydm,
            }
            const res1 = await getZongJiaoInfo(params)
            if (res1.data.data.length > 0) {
              this.saveUpdates()
            } else {
              Dialog.alert({
                title: '提示',
                message: '经与宗教大数据信息核对，您录入的信息不存在，请核实。',
              }).then(() => {})
            }
          }
        })
      }
    },
    saveUpdates: async function () {
      console.log(this.formData)
      console.log(this.formDataPC)
      let formBT = true
      // if (this.formData.fwyt == '6') {
      //   if (!this.formData.sftszz) {
      //     formBT = false
      //   }
      // }
      // if (this.formData.jglx == 1 && !this.formData.jtjglx) {
      //   formBT = false
      // }
      // if (this.formData.jglx == 9 && !this.formData.jtjglxnr) {
      //   formBT = false
      // }
      // if (this.formData.sfgkj == 1) {
      //   if (this.formData.gkjlx.length == 0) {
      //     formBT = false
      //   } else if (this.formData.gkjlx.indexOf('7') != -1 && !this.formData.gkjnr) {
      //     formBT = false
      //   }
      // }
      // for (let i in this.formData) {
      //   if (i !== 'sftszz' && i !== 'jtjglx' && i !== 'jtjglxnr' && i !== 'gkjlx' && i !== 'gkjnr') {
      //     if (!this.formData[i]) {
      //       formBT = false
      //     }
      //   }
      // }
      // for (let i in this.formDataPC) {
      //   if (!this.formDataPC[i]) {
      //     formBT = false
      //   }
      // }
      if (formBT) {
        this.formData['TO_ROW_GUID'] = this.rowData.ROW_GUID
        let params = {
          accessCode: this.isNewSave ? '0fb3f6123d1b4fe6851c99532c463f6f' : '77ad6c1591e54d4fbc45ecc90374a2a2',
          cityCode: window.localStorage.getItem('citycode')
            ? window.localStorage.getItem('citycode')
            : '441300000000',
          params: {
            dataGuid: '760e6043-1b3a-4c10-b407-729c69c74dc0',
            strParams: JSON.stringify([this.formData]),
            token: window.localStorage.getItem('token'),
          },
        }
        const res = await FileServerProxy(params)
        let datas = JSON.parse(res.data.data).Success
        if (datas) {
          this.$toast.success(this.isNewSave ? '保存成功!' : '修改成功!')
        }
      } else {
        this.$toast.fail('请输入必填项!')
      }
    },
    submitData: async function (){
      let paerknh = {
        procName: "up_management",
        dtParams: JSON.stringify([{ I_USERID:  this.rowData.ROW_GUID, TYPE: 18 }]),
        token: window.localStorage.getItem("token"),
      };
      let params4 = {
        accessCode: "69db6bece3a7480592e2ec753d1e335e",
        cityCode: window.localStorage.getItem("citycode")
          ? window.localStorage.getItem("citycode")
          : "441300000000",
        params: paerknh,
      };
      const resEXknh = await FileServerProxy(params4);

      let data1 = JSON.parse(resEXknh.data.data).Data[0]
      console.log(data1)
      if (data1.NODE_GUID=='{4AE42851-C739-4610-A461-E6F9E29CC25E}'){
        this.$router.push({
          path: "/TreeSelectZLWG",
          query: { data: data1, list: "1" },
        });
      }else{
        this.$message.error("暂无页面")
      }

    },
    // 保存
    SaveData: async function () {
      this.isSave = true
      // let formBT = true;
      // if(this.formData.housetype&&this.formData.fwyt&&this.formData.jglx&&this.formData.sfgkj){
      //   if(this.formData.housetype == 1){
      //     if(!this.formData.cqrxm||!this.formData.cqrzjhm){
      //       formBT = false
      //     }
      //   }
      //   if(this.formData.housetype == 2){
      //     if(!this.formData.cqdwmc||!this.formData.cqdwxydm||!this.formData.cqdwfr||!this.formData.cqdwfrzjhm){
      //       formBT = false
      //     }
      //   }
      //   if(this.formData.fwyt == 1){
      //     if(!this.formData.sftszz||!this.formData.jtfwytxydm||this.formData.jtfwyt.length==0){
      //       formBT = false
      //     }
      //   }
      //   if(this.formData.jglx == 1&&!this.formData.jtjglx){
      //     formBT = false
      //   }
      //   if(this.formData.sfgkj == 1){
      //     if(this.formData.gkjlx.length==0){
      //       formBT = false
      //     }else if(this.formData.gkjlx.indexOf('7')!=-1&&!this.formData.gkjnr){
      //       formBT = false
      //     }
      //   }
      // }else{
      //   formBT = false
      // }
      // this.contentData.forEach(item=>{
      //   let arr = []
      //   if(item.children){
      //     item.children.forEach(items=>{
      //       if(items.type == "select" && !this.formDataPC[items.key]){
      //         formBT = false
      //       }else if(items.type == "Checkbox"&&this.formDataPC[items.key].length == 0){
      //         formBT = false
      //       }else if(items.type != "select" && this.formDataPC[items.key] === "0"){
      //         arr.push(items.key)
      //       }
      //     })
      //   }
      //   if (item.fileData) {
      //     item.fileData.forEach((items, index) => {
      //       if ( items.fileList.length == 0) {
      //         formBT = false;
      //       }
      //     });
      //   }
      //   if(item.name == '建筑周边环境'||item.name == '地基基础'||item.name == '现场检查'){
      //     if(arr.length == 0 ){
      //       formBT = false
      //     }
      //   }
      //
      // })
      // if(formBT){
      console.log(typeof this.formData.gkjlx)
      this.formData.citycode = window.sessionStorage.getItem('citycodeCun')
      // if (typeof this.formData.gkjlx == 'object'){
      //   this.formData.gkjlx = this.formData.gkjlx.join(",")
      //   this.formData.jtfwyt = this.formData.jtfwyt.join(",")
      // }
      // this.formData.sjlx = window.sessionStorage.getItem('citycodeRole')
      this.formDataPC.isCheck = '0'
      this.formDataPC.baseHousePicture = this.UploadFileId.join(',')
      delete this.formData.houseRadio
      let params = {
        // 基本情况
        houseCheckBaseInfo: this.formData,
        // 现场状况
        houseCheckInfo: this.formDataPC,
      }
      if (typeof params.houseCheckBaseInfo.gkjlx == 'object') {
        params.houseCheckBaseInfo.gkjlx = params.houseCheckBaseInfo.gkjlx.join(',')
        params.houseCheckBaseInfo.jtfwyt = params.houseCheckBaseInfo.jtfwyt.join(',')
      }
      const res1 = await FwsaveOrUpdate(params)
      if (res1.data.code == 200) {
        this.$toast.success('保存成功!')
      } else {
        this.$toast.fail('保存失败!')
      }
    },
    radioChange(data) {
      let arr = []
      for (let i in this.formDataPC) {
        if (
          i != 'buildIsError' &&
          i != 'baseIsError' &&
          i != 'houseIsError' &&
          i != 'liveIsError' &&
          i != 'liveSoilIsError' &&
          i != 'liveStoneIsError' &&
          i != 'liveWoodIsError' &&
          i != 'liveBetonIsError' &&
          i != 'liveBrickIsError' &&
          i != 'checkFirstResult' &&
          i != 'liveStructerType' &&
          i != 'checkVertifyResult' &&
          i != 'isCheck'
        ) {
          if (this.formDataPC[i] == '0') {
            console.log(i)
            arr.push(this.formDataPC[i])
          }
        }
      }
      if (arr.indexOf('0') !== -1) {
        this.contentData.forEach((item, index) => {
          if (item.name == '初步判定') {
            item.children.forEach((item1, index1) => {
              if (item1.children.length == 3) {
                item1.children.splice(0, 1)
              }
            })
          }
        })
      } else {
        this.contentData.forEach((item, index) => {
          if (item.name == '初步判定') {
            item.children.forEach((item1, index1) => {
              if (item1.children.length == 2) {
                item1.children.unshift({
                  name: '房屋基本安全',
                  value: '1',
                  key: 'house_is_error',
                })
              }
            })
          }
        })
      }
    },
    changeData(data) {
      if (data.indexOf('7') != -1) {
        this.showData = true
      } else {
        this.showData = false
      }
    },
    changeData1(data) {
      // if (data.indexOf("14") != -1) {
      //   this.showjtfwyt = true
      // } else {
      //   this.showjtfwyt = false
      // }
    },
    getList(item) {
      this.groupGuids = item.groupGuid
    },
    afterRead(file) {
      console.log(Array.isArray(file))
      if (Array.isArray(file)) {
        file.forEach((item, index) => {
          this.getFileServerUpload(item.file)
        })
      } else {
        this.getFileServerUpload(file.file)
      }
    },
    getFile: async function () {
      this.UploadFileId = []
      this.contentData[1].fileData[0].fileList = []
      let params = {
        id: this.formDataPC.baseHousePicture,
      }
      const res = await selectListFile(params)
      this.fileData = res.data.data
      console.log(res.data.data)
      if (res.data.data) {
        res.data.data.forEach((item, index) => {
          console.log(item)
          // this.fileIdData.push(item.fileId)
          this.UploadFileId.push(item.fileId)
          console.log(window.g.BaseURL4 + item.path + '?download=0')
          this.contentData[1].fileData[0].fileList.push({
            url: window.g.BaseURL4 + item.path + '?download=0',
            isImage: true,
            fileId: item.fileId,
          })
        })
      }
    },
    getFileServerUpload: async function (file) {
      let formData = new FormData()
      formData.append('file', file)
      formData.append('token', window.localStorage.getItem('token'))
      const res = await uploadFile(formData)
      console.log(res)
      if (res.data.data) {
        this.fileGuid = res.data.data.id
        this.UploadFileId.push(res.data.data.id)
        this.$toast.success('上传成功!')
      }
      // this.fileGuid = data1[0].FILEGUID;
    },
    delectFile: async function (file) {
      console.log(file)
      console.log(typeof file)
      let fileId = ''
      if (file.file) {
        // alert(1)
        fileId = this.fileGuid
        this.UploadFileId.pop()
      } else {
        this.fileData.forEach((item, index) => {
          if (item.fileId == file.fileId) {
            fileId = item.fileId
          }
          if (this.UploadFileId) {
            this.UploadFileId.forEach((item1, index1) => {
              if (item.fileId == item1) {
                this.UploadFileId.splice(index1, 1)
              }
            })
          }
        })
      }
      let params = [fileId]
      const res = await deleteFile(params)
      console.log(res)
      if (res.data.data) {
        this.$toast.success('删除成功!')
      }
    },
    onConfirmContent(val) {
      this.DICNAME = val.DICID
      this.contentData.forEach((item, index) => {
        item.children.forEach((item1, index1) => {
          if (item1.active) {
            this.formDataPC[item1.key] = val.DICID
            item1.active = false
          }
          // if (item1.type=='Checkbox'){
          //   item1.disabled = true
          //   this.$forceUpdate()
          // }
          if (item1.name === '建筑结构') {
            // if (this.formDataPC.live_structer_type){
            //   this.disabled = false
            // }
            this.JZJG.forEach((item2, index2) => {
              if (item2.name === val.DICNAME) {
                item.children.splice(1, item.children.length - 1)
                item2.children.forEach((item3) => {
                  item.children.push(item3)
                })
              }
            })
          }
        })
      })
    },
    onConfirmRQ(val) {
      let year = val.getFullYear()
      let month = val.getMonth() + 1
      let day = val.getDate()
      let hour = val.getHours()
      let minute = val.getMinutes()
      let second = val.getSeconds()
      if (month >= 1 && month <= 9) {
        month = `0${month}`
      }
      if (day >= 1 && day <= 9) {
        day = `0${day}`
      }
      if (hour >= 0 && hour <= 9) {
        hour = `0${hour}`
      }
      if (minute >= 0 && minute <= 9) {
        minute = `0${minute}`
      }
      if (second >= 0 && second <= 9) {
        second = `0${second}`
      }
      this.formData.JCSJ = `${year}-${month}-${day}`
      this.selectData.showPickerq = false
    },
    onConfirm(val) {
      this.selectData.showPicker = false
    },
    onConfirmFWLX(val) {
      this.selectData.showPickerFWLX = false
      this.formData.housetype = val.DICID
    },
    onConfirmJGLX(val) {
      this.selectData.showPickerJGLX = false
      this.formData.JGLX = val.DICID
    },
    onConfirmJTJG(val) {
      this.selectData.showPickerJTJG = false
      this.formData.jtjglx = val.DICID
    },
    tabClick(index) {
      this.nowIndex = index
    },
    onConfirmFWYT(val) {
      this.selectData.showPickerFWYT = false
      this.formData.JTYT = val.DICID
    },
    onConfirmIFTSZZ(val) {
      this.selectData.showPickerIFTSZZ = false
      this.formData.JZCS = val.DICID
    },
    onConfirmGKJ(val) {
      this.selectData.showPickerGKJ = false
      this.formData.sfgkj = val.DICID
    },
    deleteData: async function () {
      if (this.rowData || this.isSave) {
        const res1 = await FwsaveOrDeleteFwCheck(this.formDataPC.fwid)
        console.log(res1)
        if (res1.data.data) {
          this.$toast.success('删除成功!')
        }
      } else {
        // this.$toast.fail
      }
    },
    getEnum: async function (viewID) {
      // b65d1943-66f4-49b1-b759-cd9f079dc0d3
      let params = {
        accessCode: '688bd3883572440a859dfd8ba9194e7b',
        cityCode: window.localStorage.getItem('citycode') ? window.localStorage.getItem('citycode') : '441300000000',
        params: {
          dataguid: viewID,
          searchObject: JSON.stringify([]),
          token: window.localStorage.getItem('token'),
        },
      }
      const res = await FileServerProxy(params)
      switch (viewID) {
        case 'b65d1943-66f4-49b1-b759-cd9f079dc0d3':
          this.selectData.columnsJGLX = JSON.parse(res.data.data).Data
          break
        default:
          break
      }
    },
  },
  mounted() {
    console.log()
    this.formData.PCSJ = this.getDate(true)
    this.formData.PCR = JSON.parse(window.localStorage.getItem("userName")).userName
    this.getEnum('b65d1943-66f4-49b1-b759-cd9f079dc0d3')
    // this.cityName = window.sessionStorage.getItem('citycodeQXName1D').split('  ')
    this.rowData = JSON.parse(this.$route.query.data)
    console.log(this.rowData)
    this.getData()
    // if (!this.rowData.isTrusted) {

      // this.formData.fwid = this.rowData.fwId
      // this.formDataPC.fwid = this.rowData.fwId
    // } else {
      // this.formData.fwid = this.newGuid()
      // this.formDataPC.fwid = this.formData.fwid
    // }
  },
}
</script>

<style scoped lang="scss">
#farmhouseInspector {
  height: 100vh;
  overflow-y: hidden;
  padding: 10px 0;
  .list ul li {
    min-height: 50px;
    line-height: 50px;
  }
  .btn-style1 {
    width: 67px;
    height: 30px;
    background: #eff6ff;
    border-radius: 4px;
    float: right;
    margin-top: -38px;
    display: inline-block;
    text-align: center;
    line-height: 30px;
    font-size: 14px;
    color: #007aff;
  }
  .tab ul li {
    width: 24.3%;
    height: 50px;
    background: #fff;
    float: left;
    /*line-height: 50px;*/
    text-align: center;
    color: #000;
    padding-top: 10px;
  }
  .content {
    width: 100%;
    height: calc(100vh - 120px);
    overflow-y: auto;
    padding: 10px;
  }
  .footer {
    width: 100%;
    padding: 20px;
    text-align: center;
  }
  .select {
    color: #007aff !important;
  }
}
</style>
